home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc / OpenDoc Development / Debugging Support / OpenDoc™ Source Code / OpenDocLib / ODInit.cpp next >
Encoding:
C/C++ Source or Header  |  1996-08-28  |  1.7 KB  |  80 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        ODInit.cpp
  3.  
  4.     Contains:    CFM Init routine for the OpenDoc shared library
  5.  
  6.     Owned by:    Jens Alfke
  7.  
  8.     Copyright:    © 1995 - 1996 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.          <2>     5/24/96    jpa        1246074: Call CW init/terminate routines:
  13.                                     needed for native exception support.
  14.          <2>     9/29/95    TJ        Made Changes for MAC SOM
  15.          <1>     8/11/95    jpa        first checked in
  16.  
  17.     To Do:
  18.     In Progress:
  19.         
  20. */
  21.  
  22.  
  23. #ifndef __USERSRCM__
  24. #include <UseRsrcM.h>
  25. #endif
  26.  
  27. #ifndef _ODMEMORY_
  28. #include <ODMemory.h>
  29. #endif
  30.  
  31. #ifdef __MWERKS__
  32. extern "C" {
  33.     void __initialize();        // From Metrowerks runtime library, Startup.c
  34.     void __terminate();
  35. }
  36. #endif
  37.  
  38.  
  39. extern void  BentoInit ( );     // BentoInit.cpp
  40. extern OSErr ImagingInit();        // ImagingInit.cpp
  41. extern OSErr LayoutInit();        // LayoInit.cpp
  42.  
  43.  
  44. extern "C" pascal OSErr OpenDocCFMInit( CFragInitBlockPtr );
  45. extern "C" pascal void  OpenDocCFMTerminate( );
  46.  
  47. pascal OSErr OpenDocCFMInit (CFragInitBlockPtr initBlkPtr)
  48. {
  49. #ifdef __MWERKS__
  50.     __initialize();        // Initialize static data and construct any global objects
  51. #endif
  52.  
  53.     OSErr err;
  54.  
  55.     // Initialize our resource fork for later access:
  56.     if( (err= InitLibraryResources(initBlkPtr)) != noErr ) return err;
  57.     
  58.     // Initialize ODMemory utility:
  59.     if( (err= InitODMemory()) != noErr ) return err;
  60.     
  61.     // Initialize Bento subsystem:
  62.     BentoInit ();
  63.         
  64.     // Initialize Imaging subsystem:
  65.     if( (err= ImagingInit()) != noErr ) return err;
  66.     
  67.     // Initialize Layout subsystem:
  68.     if( (err= LayoutInit()) != noErr ) return err;
  69.     
  70.     return noErr;
  71. }
  72.  
  73. pascal void OpenDocCFMTerminate( )
  74. {
  75.     CloseLibraryResources();
  76. #ifdef __MWERKS__
  77.     __terminate();        // Destruct static objects & clean up exception tables
  78. #endif
  79. }
  80.